package com.gosophia.orgManagement.action;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.gosophia.commons.web.action.BaseAjaxAction;
import com.gosophia.organizationManagement.dto.OrganizationDTO;
import com.gosophia.organizationManagement.ws.OrganizationManagementWebService;
@Controller("ProveAddOrganziationAction")
@Scope("prototype")
public class ProveAddOrganziationAction extends BaseAjaxAction<OrganizationDTO>{
    /**
     * 
     */
    private static final long serialVersionUID = 1L;
    private boolean result;
    private String orgName;
    private Long parentOrgId;
    @Autowired
    private OrganizationManagementWebService organizationManagementWebService;
    @Override
    public OrganizationDTO getDetailData() {
        return this.detailData;
    }
    @Override
    public String _execute() throws Exception {
        
        Long count = organizationManagementWebService.findEQorganizationsByParentIdAndOrgName(orgName, getParentOrgId());
        if(count>0){
            result = true;
        }else{
            result = false;
        }
        super.getRequestResult().setRsltCode("0");
        return SUCCESS;
    }
    public boolean isResult() {
        return result;
    }
    public void setResult(boolean result) {
        this.result = result;
    }
    public String getOrgName() {
        return orgName;
    }
    public void setOrgName(String orgName) {
        this.orgName = orgName;
    }
    public Long getParentOrgId() {
        return parentOrgId;
    }
    public void setParentOrgId(Long parentOrgId) {
        this.parentOrgId = parentOrgId;
    }
    
}
